#!/bin/bash
export access_token="$(cat $Gitee_Repo/etc/access_token)"
if [ -n "$1" ];then
    {
        key=$1
        if [ -n "$2" ];then
        {
            title=$2
            curl -X POST --header 'Content-Type: application/json;charset=UTF-8' 'https://gitee.com/api/v5/user/keys' -d '{"access_token":"${access_token}","key":"${key}","title":"${title}"}' >/dev/null
            exit 0
        }
        fi
    }fi
echo -e "
使用方法: gitee newkey [密钥] [上传后的密钥名称]
"
